package language;

import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class Utils {

    private Utils() {
    }

    public static LArray<LCharacter> openFile(LArray<LCharacter> fileName) {
        try {
            FileReader reader = new FileReader(fileName.toString());
            List<LCharacter> list = new ArrayList();
            int i;
            while ((i = reader.read()) != -1) {
                list.add(new LCharacter((char) i));
            }
            return LArray.of(list);
        } catch (IOException ex) {
            throw new RuntimeException(ex);
        }
    }
}
